package ${package}.aspect;

import ${package}.exception.${moduleName}ServiceException;
import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.core.annotation.Order;

/**
 * Translates DAO exceptions to service specific.
 */
@Aspect
@${systemPackage}.stereotype.Aspect
@Order(0)
public class ${moduleName}ServiceExceptionTranslatorAspect {
    /**
     * Converts exception to service specific.
     *
     * @param e throwable
     */
    @AfterThrowing(pointcut =
            "execution(* ${package}.service.${moduleName}Service.*(..))",
            throwing = "e")
    public void convert(final Throwable e) {
        throw new ${moduleName}ServiceException(e.getMessage(), e);
    }
}
